package com.dao.batch.controller;

import com.dao.batch.properties.PersonProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.naming.Name;

/**
 * Created by Administrator on 2017/9/26.
 */
@RestController
public class HelloController {


    @RequestMapping(value= "/hello", method= RequestMethod.GET)
    public String hello(){
    return "hello world";
    }
    @PostMapping("/hello")
    public String postHello(){
        return "hello post";
    }
    @PostMapping("/hello/params")
    public String postSomething(@RequestParam("content") String con){
        return "postSomething"+con;
    }
    @PostMapping("putPerson")
    public String putPerson(@RequestParam("id") Integer id,
                            @RequestParam("name") String name,
                            @RequestParam("age") Integer age){
        return     "id:"+id+" name:"+name+" age:"+age;
    }
    @Autowired
    private PersonProperties person;

    @GetMapping("/person")
    public String getPerson(){
        return  person.getName()+" "+person.getAge();
    }


}
